using System.Windows.Data;

namespace Chambills.Present.Validation
{
    /// <summary>
    /// Binding to use in XMAL with all the correct properties set for validation
    /// </summary>
    public class ValidatedBinding : Binding
    {
        public ValidatedBinding()
        {
            Initialise();
        }

        public ValidatedBinding(string path) : base(path)
        {
            Initialise();
        }

        private void Initialise()
        {
            ValidatesOnDataErrors = true;
            ValidatesOnExceptions = true;
            NotifyOnValidationError = true;
            UpdateSourceTrigger = UpdateSourceTrigger.LostFocus;
        }
    }
}